导航菜单
首页 >  Configuring and displaying symbol images in your UI  > Creating custom symbols in Affinity Designer for UI design

Creating custom symbols in Affinity Designer for UI design

Create your own symbols in Affinity Designer and use them in your UI designs by taking advantage of Apple’s SF Symbols templates and guidelines.

If you’re an app developer, you may be familiar with Apple’s SF Symbols—a huge array of vector iconography that can be easily implemented into your app’s user interface design. It’s compatible with iOS 13, watchOS 6 and tvOS 13 or later. The icons are designed to integrate with Apple’s San Francisco system font, which ensures optical alignment with neighbouring text and allows you to use line weight variations for each icon.

For more general information on SF Symbols, see Apple’s Human Interface Guidelines article.

The SF Symbols app (free to download), which lists all available symbols and allows you to preview different line weightsDesigning your own symbols

This is where things get interesting—you also have the ability to design and import your own symbol designs, using Apple’s SF Symbols template layout as a starting point. This template can be imported directly into Affinity Designer and used to create your own symbols, then brought into Xcode as a resource, allowing you to use it within your app design.

Exporting an existing symbol template

For starters, you will need to download the SF Symbols app directly from Apple’s Developer website. Once it’s installed, you can begin exploring the symbol categories within the app.

It’s a good idea to pick a symbol that roughly resembles the design you have planned for your own symbol. In this example, Matt Searston (our resident Affinity Designer Product Expert) has elected to design a cassette icon, so we might look for an existing symbol that is rectangular in shape, and so has a similar aspect ratio.

Picking a Square Grid symbol, as it has a similar aspect ratio and shape to our intended design.

Once we’ve found a similar design, we can export a template to adapt our design to—go to File>Export Custom Symbol Template, then navigate to a suitable directory and click Export. This will create an .SVG file which we can then load into Affinity Designer.

The template layout in Affinity Designer complete with grids and guidesCreating your symbol design

With the SVG loaded into Affinity Designer, you can begin creating your own design. Here are a few pointers regarding layer structure and layout:

It’s important to retain the layer structure that you see when importing the template SVG file. All of the symbol designs are located in a parent layer called Symbols.

Each line weight and size variant of the symbol is stored as a separate group with a logical naming convention. You have the line weight, then a hyphen followed by the size, for example:

Ultralight-S for ultra light line weight in small.Regular-M for regular line weight in medium.Heavy-L for heavy line weight in large.

All vector layer content must converted to outlined curves with no line width. To achieve this, you can select the layers in question and from the top menu go to Layer>Expand Stroke.

Note that you don’t actually have to store each symbol variation as a group like in the original templates: for our cassette design, we simply flattened the layers using the Add boolean operation and outlined them, then named them correctly according to the convention. These imported into Xcode without any issues.

Naming the flattened Curve layers rather than putting them into groups

Using groups will however allow you to have multiple child layers for each symbol rather than flattening them all into one layer. You may prefer this approach for flexibility.

Underneath the parent Symbols layer, you will find the Guides and Notes layers. You should generally leave the layers in Guides alone, as they will help you ensure that your new design has correct optical alignment when neighboured with text. There are two layers named left-margin and right-margin which allow you to define leading and trailing margins—you can select the Move Tool V and drag the left or right nodes on the bounding box to change the horizontal scaling of these.

The left-margin and right-margin layers: adjusting the horizontal width of these can determine padding between the symbol and surrounding text

You don’t have to alter these if you don’t need to, however. To keep things simple, we recommend creating your new symbol design without repositioning the two margins, then only rescaling them horizontally if you require more padding between the symbol and text either side.

Whilst getting to grips with the template layout and designing his own cassette symbol, Matt developed an approach that may help when it comes to producing line weight variants for your design. He started by creating the Regular line weight in Medium size, which is recommended as that’s where the two margin guides are located.

Creating the most extreme line weight and font size variants to identify any scaling issues early on

He then duplicated the layers in his symbol design and created a Black line weight in Large size variant—this is the thickest line weight and largest font size. He then did the same for an Ultralight and Small variant. By creating variants of the design at each extreme, this will quickly highlight if any of your design choices are going to be problematic when the line weight is scaled. Lots of shapes or curves next to each other may result in a design becoming less distinguishable or more cluttered, for example. By tackling these visual issues early on, you can save yourself a lot of time, then go on to produce the variants in-between these extremes.

Here are some general design pointers when creating your custom symbols:

Only use vector content: curve paths with the Pen Tool P and shapes are fine. Bitmap images and text are not.Grouping content or flattening: you don’t have to flatten your design using a boolean operation, but you must outline any content using Expand Stroke. You can either have a flattened layer with the variant name (e.g. Ultralight-S), or you can name a group which contains multiple vector layers.It’s not a steadfast requirement to provide all 27 variants of your design, but it’s a good idea to include as many as possible for accessibility features.Exporting your symbol

Exporting your symbol design is nice and straightforward: once you have checked that your layer structure adheres to that of the original template, go to File>Export, then on the export dialog choose SVG as the export format. Leave the export preset as its default of SVG (for export), then click Export and choose a suitable resources directory (e.g. one set up within your Xcode project).

Exporting to SVG using Affinity Designer’s Export dialog

Once you have your exported SVG file, you can verify it within the SF Symbols app before importing it into Xcode in case there are any issues with layer structure or alignment. To do this, launch the SF Symbols app, then go to File>Validate Custom Symbols and locate your SVG file.

Validating the custom symbol SVG file

Finally, you’ll need to bring your symbol into your app’s .xcassets resources as an Image Symbol Set. To do this within Xcode, select your .xcassets resource (a default Assets.xcassets is provided by default whenever you create a new project), then from the top menu choose Editor>Add Assets>New Symbol Image Set.

Adding the exported SVG to Xcode as a Symbol Image Set

This will switch the active window pane to a drag-drop area where you can drag your SVG file in. If everything is present and correct, your symbol variants will appear—you can now go ahead and use these in your user interface design!

The symbols imported into Xcode, ready to useFootnotes

For more information, you may like to refer to these Apple Developer articles which will help you further when it comes to adding custom symbols to your user interface design:

Creating Custom Symbols Images for Your AppConfiguring and Displaying Symbol Images in Your UI

They contain good guidelines to adhere to and will also cover adding symbols into your UI design programmatically.

相关推荐: